<template>
  <div class="backView">
    <p class="questionLabel">{{index + 1}}.{{question.title}}</p>
    <div v-for="(el,idx) in question.selectOption">
      <div v-if="selected == el.selectName" class="optionView option_s">
        <p class="option label_s">{{el.selectName + '&nbsp;:&nbsp;'}}</p>
        <p class="result label_s">{{el.result}}</p>
      </div>
      <div v-else @click="optionClick(el)" class="optionView">
        <p class="option">{{el.selectName + '&nbsp;:&nbsp;'}}</p>
        <p class="result">{{el.result}}</p>
      </div>
    </div>

  </div>
</template>

<script>

  export default{
    props:['question', 'index', 'selected'],
    data() {
      return{

      }
    },
    methods:{
      optionClick(el) {
        this.$emit('sendOptionClick', el, this.index);
      }
    }

  }


</script>

<style scoped>
  .backView {
    padding-top: 48px;
    padding-left: 32px;
    padding-right: 32px;
  }
  .questionLabel {
    font-size: 18px;
    font-weight: bold;
    color: #333333;
  }
  .optionView {
    margin-top: 16px;
    padding: 12px 20px;
    border-radius: 4px;
    background-color: #F2F5F8;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
  }

  .option_s {
    background-color: #CCE3F9;
  }
  .option {
    font-size: 18px;
    color: #333333;
  }
  .result {
    padding-top: 2px;
    font-size: 14px;
    color: #333333;
  }
  .label_s {
    color: #1286F7;
  }

</style>
